package com.example.retailmanagement.service;

import com.example.retailmanagement.mapper.OrderMapper;
import com.example.retailmanagement.model.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public boolean insertOrder(Order order) {
        return orderMapper.insertOrder(order) > 0;
    }

    @Override
    public boolean updateOrder(Order order) {
        return orderMapper.updateOrder(order) > 0;
    }

    @Override
    public Order getOrderById(Long id) {
        return orderMapper.getOrderById(id);
    }

    @Override
    public List<Order> getAllOrders() {
        return orderMapper.getAllOrders();
    }
}